import { Controller } from "egg"
import { SuccessModel, ErrorModel } from "../resp"
export default class TTSController extends Controller {
    public async tts(){
        const {ctx,service} = this
        const {appKey, fileLink} = ctx.request.query
        if(!appKey){
            return ctx.body = new ErrorModel("appKey不能为空")
        }
        if(!fileLink){
            return ctx.body = new ErrorModel("fileLink不能为空")
        }
        let data=null
        try {
            data = await service.ttsService.ttsDemo("LTAI5tPbQBjAKPMUn2U3Hf3f", "CjYoCyN3Dj25GIuG73pywqwtqW1ZT0", appKey, fileLink)  
            ctx.body = new SuccessModel(data)
        } catch (error) {
            ctx.body = new ErrorModel("合成失败")
        }
      
       
    }
}